Skip to content

fix(windows): improve install.ps1 errors for missing VC++ runtime#1962

Merged
fengmk2 merged 3 commits into
voidzero-dev:mainfrom
cheezone:main
Jun 27, 2026
Merged

fix(windows): improve install.ps1 errors for missing VC++ runtime#1962
fengmk2 merged 3 commits into
voidzero-dev:mainfrom
cheezone:main

Conversation

@cheezone

Copy link
Copy Markdown
Contributor

Summary

On clean Windows machines without the MSVC runtime, vp.exe fails to start during irm https://vite.plus/ps1 | iex with exit code 0xC0000135 (STATUS_DLL_NOT_FOUND). The installer previously reported a generic "Failed to install dependencies" with an empty install.log, and exit 1 closed the entire PowerShell window when run via iex.

This PR:

  • Detects 0xC0000135 after vp.exe install fails and prints VC++ 2015–2022 Redistributable install guidance (x64/arm64)
  • Replaces bare exit 1 with a non-CI halt path so interactive irm | iex installs keep the shell open without duplicating the error message

All Write-Error-Exit paths now keep the interactive shell open when not running under CI=true.

Context

Similar report elsewhere: kirodotdev/Kiro#9752

Test plan

  • Clean Windows without VC++: single clear error, shell stays open (no duplicate message, no window close)
  • Windows with VC++ installed: install completes normally
  • CI path (CI=true): still exits with non-zero code

@netlify

netlify Bot commented Jun 27, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit fba7366
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a3fd8ae20dd6b0008e27c5e

@fengmk2

fengmk2 commented Jun 27, 2026

Copy link
Copy Markdown
Member

@codex review

@ljlsasuke

Copy link
Copy Markdown

I’ve come across this problem too; it’s a great fix.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ec73799b7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/cli/install.ps1 Outdated
Comment thread packages/cli/install.ps1 Outdated
Comment thread packages/cli/install.ps1
cheezone added 2 commits June 27, 2026 17:54
Detect STATUS_DLL_NOT_FOUND (0xC0000135) when vp.exe install fails on
clean Windows and print VC++ Redistributable guidance. Stop using exit in
interactive irm | iex installs so the PowerShell session stays open.
- Exit with non-zero code when invoked as a script file (not only CI=true)
- Compare NTSTATUS exit codes without unsafe UInt32 casts
- Rethrow install stop signal from nested metadata catch blocks
@cheezone

Copy link
Copy Markdown
Contributor Author

Thanks for the Codex review — addressed in the latest push:

  1. Non-CI exit code: Exit-Installer now calls exit $Code when $PSCommandPath is set (e.g. powershell -File install.ps1), not only when CI=true. The catchable stop signal is only used for irm | iex where there is no script file path.

  2. NTSTATUS comparison: Test-IsDllNotFoundExitCode no longer casts arbitrary negative exit codes to [uint32]; it compares the signed value and uses -band 0xFFFFFFFF for hex matching.

  3. Nested catch: Get-PackageMetadata inner catch blocks rethrow VP_INSTALL_STOP so registry/JSON fallback does not mask an already-printed error.

@fengmk2 fengmk2 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one blocking inline comment.

Comment thread packages/cli/install.ps1 Outdated
Non-interactive powershell -Command callers should still exit non-zero after
install failure; detect -Command via process command line on Windows.
@cheezone

Copy link
Copy Markdown
Contributor Author

@fengmk2 Good catch — updated in fba7366.

Test-ShouldKeepShellOpenAfterFailure now only swallows the stop signal when all of these hold:

  • not CI=true
  • no $PSCommandPath (not -File)
  • [Environment]::UserInteractive
  • current process command line does not include -Command

So powershell -Command "irm ... | iex" exits non-zero again, while typing irm ... | iex in an open interactive shell still keeps the window open.

@fengmk2 fengmk2 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fengmk2 fengmk2 merged commit 49a79f1 into voidzero-dev:main Jun 27, 2026
53 of 54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants